<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        div{
            width: 200px;
            height: 200px;
            background: red;
            position: fixed;
            bottom: 0;
            right: 0;
        }
        .btn{
            position: absolute;
            right: 0;
        }
    </style>
</head>
<body>
    <div>
        <button class="btn">关闭</button>
    </div>
</body>
</html>
<script>
    const div = document.querySelector('div')
    const btn = document.querySelector('.btn')
    btn.onclick = function(){
        div.style.display = 'none'
        setTimeout(function(){
            div.style.display = 'block'
        },2000)
    }
</script>